package com.v.service.services.impl;

import com.v.dao.mapper.UserDOMapper;
import com.v.dao.model.UserDO;
import com.v.service.services.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDOMapper userDoMapper;

    @Override
    public List<UserDO> getResultList(Map<String, Object> params) {
        List<UserDO> result = userDoMapper.getDataList(params);
        return result;
    }

    @Override
    @Transactional
    public void updateUserDataService(UserDO userDO) {
        insertUserDataService(userDO);
        userDoMapper.updateUserData(userDO);
        // throw new RuntimeException("自定义异常");
    }

    @Override
    public void insertUserDataService(UserDO userDO) {
        userDoMapper.insertUserData(userDO);
    }
}
